/*区域后台*/
'use strict';
const regionAddAction = require('../actions/region/regionAddAction');
const regionDelAction = require('../actions/region/regionDelAction');
const regionUpdateAction = require('../actions/region/regionUpdateAction');
const regionQueryAction = require('../actions/region/regionQueryAction');

module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let action_type = param.action_type;
    try {
        switch (action_type) {
            case 'regionAdd': //区域添加
                ctx.body = await regionAddAction(param);
                break;
            case 'regionDel': //区域删除
                ctx.body = await regionDelAction(param);
                break;
            case 'regionUpdate': //区域修改
                ctx.body = await regionUpdateAction(param);
                break;
            case 'regionQuery': //区域查询
                ctx.body = await regionQueryAction(param);
                break;

        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};